package com.tong.hao.batch.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.listener.StepExecutionListenerSupport;

/**
 * @ClassName ThStepListener
 * @Author 友野浩二
 * @Date 2019/11/25 13:25
 * @Description Step监听器
 * @Version 1.0
 *
 * <pre>
 *     Spring Batch 对于【任务或步骤】开始和结束都会提供监听,以便开发人员实现监听逻辑。
 * </pre>
 */
@Slf4j
public class ThStepListener extends StepExecutionListenerSupport {

    @Override
    public void beforeStep(StepExecution stepExecution) {
        log.info("Th Step before");
    }

    @Override
    public ExitStatus afterStep(StepExecution stepExecution) {
        log.info("Th Step end!");
        return super.afterStep(stepExecution);
    }
}
